package com.airport.ticket.entity;

import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.Date;

@Data
public class BoradQuery {

    /**
     * 实体类
     */
    private Borad entity = new Borad();

    /**
     * 查询关键字
     */
    private String keyword;
    /**
     * 发布时间范围
     */
    private Date pubTimeSt;
    private Date pubTimeEd;

    /**
     * 排序
     */
    private String orderBy;

    /**
     * 以下是常量
     */
    public static final String KEYWORD_FINA = "keyword";

    /**
     * sql语句变量
     */
    private static final String SQL_LIKE = "%";

    public String getKeyword() {
        if (!StringUtils.isEmpty(this.keyword) && !this.keyword.startsWith(SQL_LIKE)) {
            this.keyword = SQL_LIKE + this.keyword + SQL_LIKE;
        }
        return keyword;
    }
}
